def test_sync_projects_update(self): """Testing sync_projects() updating a schedule.""" client = ndb.Client() cloud_scheduler_client = CloudSchedulerClient() with client.context(): Project(name='test1', schedule='0 8 * * *', project_yaml_contents='', dockerfile_contents='').put() Project(name='test2', schedule='0 9 * * *', project_yaml_contents='', dockerfile_contents='').put() projects = { 'test1': ProjectMetadata('0 8 * * *', '', ''), 'test2': ProjectMetadata('0 7 * * *', '', '') } sync_projects(cloud_scheduler_client, projects) projects_query = Project.query() self.assertEqual({ 'test1': '0 8 * * *', 'test2': '0 7 * * *' }, {project.name: project.schedule for project in projects_query})
def test_sync_projects(self): """Testing sync_projects().""" client = ndb.Client() with client.context(): Project(name='test1').put() Project(name='test2').put() projects = {'test1', 'test3'} sync_projects(projects) projects_query = Project.query() self.assertEqual(projects, {project.name for project in projects_query})
def test_sync_projects_delete(self): """Testing sync_projects() deleting.""" client = ndb.Client() cloud_scheduler_client = CloudSchedulerClient() with client.context(): Project(name='test1', schedule='0 8 * * *').put() Project(name='test2', schedule='0 9 * * *').put() projects = {'test1': ProjectMetadata('0 8 * * *')} sync_projects(cloud_scheduler_client, projects) projects_query = Project.query() self.assertEqual( {'test1': '0 8 * * *'}, {project.name: project.schedule for project in projects_query})
from main import Project import unittest console = Project() class TestCases(unittest.TestCase): def test_login(self): self.assertEqual(console.command("login <User> <Password>"), "Log in Success") # Assume no users logged in def test_logoff(self): self.assertEqual(console.command("logout"), "Log out Success") # Assume any user logged in def test_createCourse(self): self.assertEqual(console.command("createclass <Course>"), "Course Created") # Assume supervisor logged in def test_createAccount(self): self.assertEqual( console.command("createaccount <NewUser> <NewPassword>"), "Account Created") # Assume supervisor logged in def test_deleteAccount(self): self.assertEqual( console.command("deleteaccount <User>"), "Account Deleted" ) # Assume supervisor logged in with at least 1 user account def test_editAccount(self): self.assertEqual(