Exemple #1
0
 def test_sorting(self):
     store = EmployeeStore(None)
     names = ('Urkki', 'Manu', 'Mara', 'JK')
     for name in names:
         store.add_employee(name, '2009-12-12')
     self.assertEquals([e.name for e in store.get_all_employees()],
                       sorted(names))
Exemple #2
0
 def create(self):
     default_db = os.path.join(tempfile.gettempdir(), 'vacalcdb.csv')
     self._db_file = os.environ.get('VACALC_DB', default_db)
     self._size = os.stat(self._db_file).st_size if os.path.exists(
         self._db_file) else 0
     self._store = EmployeeStore(self._db_file)
     self._frame = VacalcFrame(EmployeeController(self._store))
     self._frame.show()
 def create(self):
     default_db = os.path.join(tempfile.gettempdir(), 'vacalcdb.csv')
     self._db_file = os.environ.get('VACALC_DB', default_db)
     self._store = EmployeeStore(self._db_file)
     self._frame = VacalcFrame(EmployeeController(self._store), CurrentDate)
     self._frame.show()
Exemple #4
0
 def test_adding_employee(self):
     store = EmployeeStore(None)
     employee = store.add_employee('Test Employee Store', '2000-12-24')
     self._assert_employee(employee, 'Test Employee Store',
                           date(2000, 12, 24))
     self.assertEquals(store.get_all_employees(), [employee])
Exemple #5
0
 def test_sorting(self):
     store = EmployeeStore(None)
     names = ('Urkki', 'Manu', 'Mara', 'JK')
     for name in names:
         store.add_employee(name, '2009-12-12')
     self.assertEquals([e.name for e in store.get_all_employees()], sorted(names))
Exemple #6
0
 def test_getting_employee(self):
     store = EmployeeStore(None)
     employee = store.add_employee('Mr Foo Bar', '1990-02-03')
     self.assertEquals(store.get_employee('Mr Foo Bar'), employee)
Exemple #7
0
 def test_adding_duplicate_employee(self):
     store = EmployeeStore(None)
     store.add_employee('test', '2000-12-24')
     self.assertRaises(VacalcError, store.add_employee,
                       'test', '2001-01-24')
Exemple #8
0
 def test_adding_employee(self):
     store = EmployeeStore(None)
     employee = store.add_employee('Test Employee Store', '2000-12-24')
     self._assert_employee(employee, 'Test Employee Store',
                           date(2000, 12, 24))
     self.assertEquals(store.get_all_employees(), [employee])
Exemple #9
0
 def test_get_missing_employee(self):
     store = EmployeeStore(None)
     self.assertRaises(VacalcError, store.get_employee, 'I am not here')
Exemple #10
0
 def test_getting_employee(self):
     store = EmployeeStore(None)
     employee = store.add_employee('Mr Foo Bar', '1990-02-03')
     self.assertEquals(store.get_employee('Mr Foo Bar'), employee)
Exemple #11
0
 def test_adding_duplicate_employee(self):
     store = EmployeeStore(None)
     store.add_employee('test', '2000-12-24')
     self.assertRaises(VacalcError, store.add_employee, 'test',
                       '2001-01-24')
Exemple #12
0
def get_employee_names():
    default_db = os.path.join(tempfile.gettempdir(), 'vacalcdb.csv')
    db_file = os.environ.get('VACALC_DB', default_db)
    return [emp.name for emp in EmployeeStore(db_file).get_all_employees()]