def test_delete_project(self): project = create_test_project('abc_123', ['a']) self.assertTrue(self.ddb.store(project)) self.assertEqual(len(self.ddb.query(Project)), 1) self.ddb.delete(Project, project.project_id) self.assertEqual(len(self.ddb.query(Project)), 0)
def test_delete_project(ddb): """Test to see if we can successfully delete a team.""" project = create_test_project('abc_123', ['a']) ddb.store(project) assert len(ddb.query(Project)) == 1 ddb.delete(Project, project.project_id) assert len(ddb.query(Project)) == 0
def setUp(self): self.app = Flask(__name__) self.u0 = User('U03548940') self.u0.github_username = '******' self.u0.github_id = '534593' self.admin = create_test_admin('Uadmin') self.p0 = create_test_project( 'GTID', ['https://github.com/ubclaunchpad/rocket2']) self.p1 = create_test_project( '', ['https://github.com/ubclaunchpad/rocket2']) self.t0 = Team('GTID', 'team-name', 'name') self.db = MemoryDB(users=[self.u0, self.admin], teams=[self.t0], projs=[self.p0, self.p1]) self.testcommand = ProjectCommand(self.db)
def test_store_retrieve_project(ddb): """Test to see if we can store and retrieve the same user.""" project = create_test_project('123456', ['https://github.com/ubclaunchpad/rocket2']) success = ddb.store(project) another_project = ddb.retrieve(Project, project.project_id) assert success assert project == another_project
def test_store_retrieve_project(self): """Test to see if we can store and retrieve the same user.""" urls = ['https://github.com/ubclaunchpad/rocket2'] project = create_test_project('123456', urls) success = self.ddb.store(project) another_project = self.ddb.retrieve(Project, project.project_id) self.assertTrue(success) self.assertEqual(project, another_project)
def test_query_project(ddb): """Test to see if we can store and query the same project.""" project = create_test_project('123456', ['abcd']) assert ddb.store(project) projects = ddb.query(Project, [('tags', 'python')]) strict_projects = ddb.query(Project, [('tags', 'python'), ('tags', 'docker'), ('display_name', 'Rocket2')]) all_projects = ddb.query(Project) assert project == projects[0] assert project == strict_projects[0] assert project == all_projects[0]
def test_query_project(self): """Test to see if we can store and query the same project.""" project = create_test_project('123456', ['abcd']) self.assertTrue(self.ddb.store(project)) projects = self.ddb.query(Project, [('tags', 'python')]) query = [('tags', 'python'), ('tags', 'docker'), ('display_name', 'Rocket2')] strict_projects = self.ddb.query(Project, query) all_projects = self.ddb.query(Project) self.assertEqual(project, projects[0]) self.assertEqual(project, strict_projects[0]) self.assertEqual(project, all_projects[0])
def test_store_project(ddb): """Test storing project calls correct functions.""" dbf = DBFacade(ddb) test_project = create_test_project('1', ['a']) dbf.store(test_project) ddb.store.assert_called_with(test_project)