def setUp(self): self.user_info_1 = { "username": "******", "password": "******", "email": "test_email_1", } self.user_info_2 = { "username": "******", "password": "******", "email": "test_email_2", } self.test_user_1 = user_model.User(**self.user_info_1) self.test_user_2 = user_model.User(**self.user_info_2) self.test_user_1.create() self.test_user_2.create()
def test_init(self): test_user = user_model.User(**self.user_info) self.assertEqual(test_user.username, self.user_info["username"]) self.assertNotEqual(test_user.password, self.user_info["password"]) self.assertTrue(test_user.validate_password( self.user_info["password"])) self.assertEqual(test_user.email, self.user_info["email"]) self.assertIsInstance(test_user.created_at, datetime.datetime) self.assertIsInstance(test_user.updated_at, datetime.datetime)
def setUp(self): self.user_info_1 = { "username": "******", "password": "******", "email": "test_email_1", } self.user_info_2 = { "username": "******", "password": "******", "email": "test_email_2", } self.file_info_1 = { "user_id": 1, "name": "test_name_1", "directory": "test_directory_1", "compilation_options": ["option1", "option2", "option3"], "language": "test_language_1", "status": "test_status_1", } self.file_info_2 = { "user_id": 2, "name": "test_name_2", "directory": "test_directory_2", "compilation_options": ["option1", "option2", "option3"], "language": "test_language_2", "status": "test_status_2", } self.test_user_1 = user_model.User(**self.user_info_1) self.test_user_1.id = self.user_info_1["id"] = 1 self.test_user_2 = user_model.User(**self.user_info_2) self.test_user_2.id = self.user_info_2["id"] = 2 self.test_file_1 = file_model.SourceCodeFile(**self.file_info_1) self.test_file_2 = file_model.SourceCodeFile(**self.file_info_2) self.test_user_1.create() self.test_user_2.create() self.test_file_1.create() self.test_file_2.create()
def setUpClass(cls): cls.user_info_1 = { "username": "******", "password": "******", "email": "test_email_1", } cls.user_info_2 = { "username": "******", "password": "******", "email": "test_email_2", } cls.test_user_1 = user_model.User(**cls.user_info_1) cls.test_user_1.id = cls.user_info_1["id"] = 1 cls.test_user_2 = user_model.User(**cls.user_info_2) cls.test_user_2.id = cls.user_info_2["id"] = 2 cls.test_user_1.create() cls.test_user_2.create()
def setUpClass(cls): cls.new_user_info = { "username": "******", "password": "******", "email": "*****@*****.**" } cls.existing_user_info = { "username": "******", "password": "******", "email": "*****@*****.**", } cls.test_existing_user = user_model.User(**cls.existing_user_info) cls.test_existing_user.create()
def setUpClass(cls): cls.mock_language = "language" cls.mock_root_upload_path = "/results/language" os.makedirs(cls.mock_root_upload_path) cls.c_source_code_snippet_hello_c = os.path.dirname( __file__) + "/../test_source_code_snippets/hello.c" cls.user_info = { "username": "******", "password": "******", "email": "*****@*****.**" } cls.test_user = user_model.User(**cls.user_info) cls.test_user.id = cls.user_info["id"] = 1 cls.test_user.create()
def setUpClass(cls): cls.user_info = { "username": "******", "password": "******", "email": "*****@*****.**" } cls.test_user = user_model.User(**cls.user_info) cls.test_user.id = cls.user_info["id"] = 1 cls.test_user.create() cls.token_valid = authentication.Authentication.generate_token(1, 60) cls.c_source_code_snippet_hello_c = os.path.dirname(__file__) + "/../test_source_code_snippets/hello.c" cls.c_source_code_snippet_hello_error_c = os.path.dirname(__file__) + "/../test_source_code_snippets/hello_error.c" cls.handler_c = compilation_handlers_dictionary["C"]
def setUpClass(cls): cls.mock_language = "language_view_file" cls.mock_root_upload_path = "/results/language_view_file" handler = MockedCompilationHandler(cls.mock_language, cls.mock_root_upload_path) compilation_handlers_dictionary[cls.mock_language] = handler cls.full_file_path = handler._format_full_file_path( "1", "mock_subpath") cls.file_name = "hello.c" cls.c_source_code_snippet_hello_c = os.path.dirname( __file__) + "/../test_source_code_snippets/hello.c" os.makedirs(cls.full_file_path) shutil.copyfile(cls.c_source_code_snippet_hello_c, cls.full_file_path + "/" + cls.file_name) cls.user_info_1 = { "username": "******", "password": "******", "email": "*****@*****.**" } cls.user_info_2 = { "username": "******", "password": "******", "email": "*****@*****.**" } cls.file_info_1 = { "user_id": 1, "name": "hello.c", "directory": "mock_subpath", "compilation_options": ["mock_option_1", "mock_option_2"], "language": cls.mock_language, "status": "test_status_1", } cls.file_info_2 = { "user_id": 1, "name": "test_name_2", "directory": "test_directory_2", "compilation_options": [], "language": cls.mock_language, "status": "test_status_2", } cls.file_info_3 = { "user_id": 2, "name": "test_name_3", "directory": "test_directory_3", "compilation_options": [], "language": cls.mock_language, "status": "test_status_3", } cls.test_user_1 = user_model.User(**cls.user_info_1) cls.test_user_1.id = cls.user_info_1["id"] = 1 cls.test_user_2 = user_model.User(**cls.user_info_2) cls.test_user_2.id = cls.user_info_2["id"] = 2 cls.test_file_1 = file_model.SourceCodeFile(**cls.file_info_1) cls.test_file_1.id = cls.file_info_1["id"] = 1 cls.test_file_2 = file_model.SourceCodeFile(**cls.file_info_2) cls.test_file_2.id = cls.file_info_2["id"] = 2 cls.test_file_3 = file_model.SourceCodeFile(**cls.file_info_3) cls.test_file_3.id = cls.file_info_3["id"] = 3 cls.test_user_1.create() cls.test_user_2.create() cls.test_file_1.create() cls.test_file_2.create() cls.test_file_3.create() cls.token_valid_1 = authentication.Authentication.generate_token(1, 60)
def setUpClass(cls): cls.user_info_1 = { "username": "******", "password": "******", "email": "test_email_1", } cls.user_info_2 = { "username": "******", "password": "******", "email": "test_email_2", } cls.file_info_1 = { "user_id": 1, "name": "test_name_1", "directory": "test_directory_1", "compilation_options": ["option1", "option2", "option3"], "language": "test_language_1", "status": "test_status_1", } cls.file_info_2 = { "user_id": 1, "name": "test_name_2", "directory": "test_directory_2", "compilation_options": ["option1", "option2", "option3"], "language": "test_language_1", "status": "test_status_2", } cls.file_info_3 = { "user_id": 1, "name": "test_name_3", "directory": "test_directory_3", "compilation_options": ["option1", "option2", "option3"], "language": "test_language_2", "status": "test_status_1", } cls.file_info_4 = { "user_id": 2, "name": "test_name_2", "directory": "test_directory_4", "compilation_options": ["option1", "option2", "option3"], "language": "test_language_2", "status": "test_status_2", } cls.test_user_1 = user_model.User(**cls.user_info_1) cls.test_user_1.id = cls.user_info_1["id"] = 1 cls.test_user_2 = user_model.User(**cls.user_info_2) cls.test_user_2.id = cls.user_info_2["id"] = 2 cls.test_file_1 = file_model.SourceCodeFile(**cls.file_info_1) cls.test_file_1.id = cls.file_info_1["id"] = 1 cls.test_file_2 = file_model.SourceCodeFile(**cls.file_info_2) cls.test_file_2.id = cls.file_info_2["id"] = 2 cls.test_file_3 = file_model.SourceCodeFile(**cls.file_info_3) cls.test_file_3.id = cls.file_info_3["id"] = 3 cls.test_file_4 = file_model.SourceCodeFile(**cls.file_info_4) cls.test_file_4.id = cls.file_info_4["id"] = 4 cls.test_user_1.create() cls.test_user_2.create() cls.test_file_1.create() cls.test_file_2.create() cls.test_file_3.create() cls.test_file_4.create()