Ejemplo n.º 1
0
    def testSearch(self):
        client = self.create_client()

        user_a = self.store.find(LoginUser, id=1).one()
        user_b = self.store.find(LoginUser, id=2).one()

        ClientSalaryHistory(date=datetime.datetime(2012, 1, 1),
                            new_salary=1000,
                            old_salary=0,
                            client=client,
                            user=user_a,
                            store=self.store)
        ClientSalaryHistory(date=datetime.datetime(2012, 2, 2),
                            new_salary=2000,
                            old_salary=1000,
                            client=client,
                            user=user_b,
                            store=self.store)
        ClientSalaryHistory(date=datetime.datetime(2012, 3, 3),
                            new_salary=3000,
                            old_salary=2000,
                            client=client,
                            user=user_a,
                            store=self.store)

        search = ClientSalaryHistorySearch(self.store, client)

        search.search.refresh()
        self.check_search(search, 'client-salary-history-no-filter')

        search.set_searchbar_search_string('ad')
        search.search.refresh()
        self.check_search(search, 'client-salary-history-string-filter')
Ejemplo n.º 2
0
    def test_add(self):
        client = self.create_client()
        user = self.create_user()

        client.salary = 20
        ClientSalaryHistory.add(self.store, 10, client, user)
        salary_histories = self.store.find(ClientSalaryHistory)
        last_salary_history = salary_histories.order_by(ClientSalaryHistory.id).last()

        self.assertEquals(last_salary_history.client, client)
        self.assertEquals(last_salary_history.new_salary, 20)
Ejemplo n.º 3
0
    def test_add(self):
        client = self.create_client()
        user = self.create_user()

        client.salary = 20
        ClientSalaryHistory.add(self.store, 10, client, user)
        salary_histories = self.store.find(ClientSalaryHistory)
        last_salary_history = salary_histories.order_by(
            ClientSalaryHistory.id).last()

        self.assertEquals(last_salary_history.client, client)
        self.assertEquals(last_salary_history.new_salary, 20)
Ejemplo n.º 4
0
 def on_confirm(self):
     if self.model.salary != self._original_salary:
         ClientSalaryHistory.add(self.store, self._original_salary,
                                 self.model, api.get_current_user(self.store))
Ejemplo n.º 5
0
 def on_confirm(self):
     if self.model.salary != self._original_salary:
         ClientSalaryHistory.add(self.store, self._original_salary, self.model, api.get_current_user(self.store))