Skip to content
Snippets Groups Projects
Commit 0b97f07d authored by david's avatar david
Browse files

modified ci and flake8 added

parent 9e6bbcd4
No related branches found
No related tags found
No related merge requests found
Pipeline #626 failed with stage
in 12 seconds
......@@ -7,14 +7,17 @@ stages:
job:test:unit:
before_script:
- echo "Install Dependancies"
- sed -i 's/http\:\/\/dl-cdn.alpinelinux.org/https\:\/\/alpine.global.ssl.fastly.net/g' /etc/apk/repositories
- apk update
- apk add python3
- apk add py-pip
- pip install pytest mysql-connector-python get_docker_secret docker
- pip install pytest mysql-connector-python get_docker_secret docker flake8
- echo "Start Tests"
script:
- cd tests
- pytest -v
- cd ..
- flake8 --max-line-length=120 softwares/server/*
after_script:
- echo "Tests have been done"
# Authors : Julien DAVID & Ismail MOUMNI
# Authors : Julien DAVID & Ismail MOUMNI
import socket
__RDOS_Port__= 9393
__RDOS_Host__='127.0.0.1'
# Function server_conn creates a socket and connects it to server
# Function server_conn take No arguments
# Function returns a socket after making connexion
def server_conn(host,port):
__RDOS_Port__ = 9393
__RDOS_Host__ = '127.0.0.1'
# Function server_conn creates a socket and connects it to server
# Function server_conn take No arguments
# Function returns a socket after making connexion
def server_conn(host, port):
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((host,port))
s.connect((host, port))
return s
# send_mess Function that return a message from a server to a client connexion
# Send_mess Function that return a message from a server to a client connexion
# Function takes 2 parameters (Socket & Message )
# Function Output message send from server
def send_message(conn: socket, message: str):
data = ""
if len(message)!=0:
conn.send(bytes(message,"utf-8"))
if len(message) != 0:
conn.send(bytes(message, "utf-8"))
data = conn.recv(1024)
return data
return data
# Function run_client connects client to server by socket
# Function run_client takes 3 parameters -Host : IP ADDRESS OF SERVER -Port : Server PORT -MESS:Message sent to the server
# Function run_Client returns the state of the server
def run_client(Host, Port, message : str):
s = server_conn(Host,Port)
print("Starting connexion to server on Port :", Port)
recv = send_message(s,message)
print("Message ENVOYÉ : ",recv)
# Function run_client connects client to server by socket
# Function run_client takes 3 parameters - Host : IP ADDRESS OF SERVER
# - Port : Server PORT
# - MESS : Message sent to the server
# Function run_Client returns the state of the server
def run_client(Host, Port, message: str):
s = server_conn(Host, Port)
print("Starting connexion to server on Port :", Port)
recv = send_message(s, message)
print("Message ENVOYÉ : ", recv)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment