Exemplo n.º 1
0
    def test_create_faultsource(self):
        self.skipTest(
            "because https://bugs.launchpad.net/oq-platform/+bug/1221921")
        self._join_traces()
        fault = self._populate_fault(self._join_fault_sections())
        ret = utils.create_faultsource(fault)

        self.assertEqual('u_sm_d_min', ret)

        fault.u_sm_d_min = 10
        fault.u_sm_d_pref = 20
        fault.u_sm_d_max = 30

        fault.low_d_min = 100
        fault.low_d_pref = 200
        fault.low_d_max = 300

        fault.dip_min = 10
        fault.dip_max = 30
        fault.dip_pref = 20

        fault.dip_dir = 20
        fault.slip_type = 'reverse'
        fault.aseis_slip = 10

        fault.save()

        ret = utils.create_faultsource(fault)

        self.assertEqual(None, ret)
Exemplo n.º 2
0
    def test_create_faultsource(self):
        self.skipTest(
            "because https://bugs.launchpad.net/oq-platform/+bug/1221921"
        )
        self._join_traces()
        fault = self._populate_fault(self._join_fault_sections())
        ret = utils.create_faultsource(fault)

        self.assertEqual('u_sm_d_min', ret)

        fault.u_sm_d_min = 10
        fault.u_sm_d_pref = 20
        fault.u_sm_d_max = 30

        fault.low_d_min = 100
        fault.low_d_pref = 200
        fault.low_d_max = 300

        fault.dip_min = 10
        fault.dip_max = 30
        fault.dip_pref = 20

        fault.dip_dir = 20
        fault.slip_type = 'reverse'
        fault.aseis_slip = 10

        fault.save()

        ret = utils.create_faultsource(fault)

        self.assertEqual(None, ret)
Exemplo n.º 3
0
def create_faultsource(request):
    if request.method == 'POST':
        json_data = simplejson.loads(request.raw_post_data)
        fault_id = json_data['fault_id'].split('.')[-1]
        fault = models.Fault.objects.get(pk=fault_id)
        error = utils.create_faultsource(fault)
        if not error:
            return OK_RESPONSE
        else:
            return HttpResponseBadRequest(error)
    else:
        return HttpResponseBadRequest()